package com.javajun.endofterm.entity;

import com.javajun.endofterm.common.CommonEntity;

import javax.persistence.*;
import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * Description: 快递实体类
 * Author: Xiong Limin
 * Date: 2020-12-03-12:41 下午
 */
@Entity
public class ExpressDelivery extends CommonEntity<Integer> {
    private String orderNumber; //快递单号
    private Date inputTime; //录入时间

    @ManyToOne(cascade = {CascadeType.MERGE, CascadeType.REFRESH})
    @JoinColumn
    private Domitory domitory; //宿舍
    private String addressee; //收件人
    private String pickUpCode; //取件码
    private Integer whetherPickUp; // 是否已取件, 0 没有取件,1 已取件
    private String pickUpName; //取件人名字
    private Date pickUpTime; //取件时间

    /**
     * 获取宿舍名,不持久化
     * @return
     */
    @Transient
    public String getDomitoryName() {
        String str = "";
        if (domitory != null) {
            str = domitory.getName();
        }
        return str;
    }

    public String getOrderNumber() {
        return orderNumber;
    }

    public void setOrderNumber(String orderNumber) {
        this.orderNumber = orderNumber;
    }

    public Date getInputTime() {
        return inputTime;
    }

    public void setInputTime(Date inputTime) {
        this.inputTime = inputTime;
    }

    public Domitory getDomitory() {
        return domitory;
    }

    public void setDomitory(Domitory domitory) {
        this.domitory = domitory;
    }

    public String getAddressee() {
        return addressee;
    }

    public void setAddressee(String addressee) {
        this.addressee = addressee;
    }

    public Integer getWhetherPickUp() {
        return whetherPickUp;
    }

    public void setWhetherPickUp(Integer whetherPickUp) {
        this.whetherPickUp = whetherPickUp;
    }

    public String getPickUpName() {
        return pickUpName;
    }

    public void setPickUpName(String pickUpName) {
        this.pickUpName = pickUpName;
    }

    public String getPickUpCode() {
        return pickUpCode;
    }

    public Date getPickUpTime() {
        return pickUpTime;
    }

    public void setPickUpTime(Date pickUpTime) {
        this.pickUpTime = pickUpTime;
    }

    public void setPickUpCode(String pickUpCode) {
        this.pickUpCode = pickUpCode;
    }
}
